package cho114366.basic;

import java.util.Scanner;

public class Ch04_05 {

	public static void main(String[] args) {
		
		Add add=new Add();
		Sub sub=new Sub();
		Mul mul=new Mul();
		Div div=new Div();
		System.out.println("두 정수와 연산자를 입력하시오.");
		Scanner sc=new Scanner(System.in);
		System.out.println("정수1");
		int num1=sc.nextInt();
		System.out.println("정수2");
		int num2=sc.nextInt();
		System.out.println("문자"
				+ "");
		String cha=sc.next();
		
		switch (cha) {
		case "+":add.setValue(num1, num2);
		System.out.println(add.calculate());
			break;
		case "*":mul.setValue(num1, num2);
		System.out.println(mul.calculate());
		break;
		case "-":sub.setValue(num1, num2);
		System.out.println(sub.calculate());
		break;
		case "/":div.setValue(num1, num2);
		System.out.println(div.calculate());
		break;
		default:
			break;
		}
		

}
}
class Add {
	int a;
	int b;

	void setValue(int a, int b) {
		this.a = a;
		this.b = b;
	}

	public Add() {
	}

	public Add(int a, int b) {
		this.a = a;
		this.b = b;
	}

	int calculate() {
		int c = a + b;
		return c;

	}
}

class Sub {
	int a;
	int b;

	void setValue(int a, int b) {
		this.a = a;
		this.b = b;
	}

	public Sub(){}

	public Sub(int a,int b){
		this.a=a;
		this.b=b;}
		int calculate(){
			int d = a-b;
			return d;}
	}
	
	class Mul {
		int a;
		int b;

		void setValue(int a, int b) {
			this.a = a;
			this.b = b;
		}
		public Mul() {
		}

		public Mul(int a,int b){
			this.a=a;
			this.b=b;}
		int calculate(){
			int e = a*b;
			return e;
			}
	}
	class Div {
		int a;
		int b;

		void setValue(int a, int b) {
			this.a = a;
			this.b = b;
		}
		public Div(){}

		public Div(int a,int b){
	this.a=a;
	this.b=b;}
		double calculate(){	
		double f=a/b;
		return f;
		}
	}


